{{include file=Yaf\Application::app()->getConfig()->user->header_html}}
</head>
<body>

<div class="ok-body">
    <ul class="layui-tab-title">
        <li class="layui-this">
            <a href="/admin/User/user_info">修改个人信息</a>
        </li>
        <li>
            <a href="/admin/Setting/password">修改密码</a>
        </li>
    </ul>
    <!--form表单-->
    <div class="layui-tab-content" style="height: 100px;">
        <div class="layui-tab-item layui-show">
            <form class="layui-form ok-form" lay-filter="filter">
                <div class="layui-form-item">
                    <label class="layui-form-label">昵称</label>
                    <div class="layui-input-block">
                        <input type="text" name="user_nickname" placeholder="请输入昵称" autocomplete="off" class="layui-input" lay-verify="required" value="{{$admin['user_nickname']}}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-block">
                        <input type="radio" name="sex" value="0" title="保密" {{if $admin['sex'] == 0}}checked {{/if}}>
                        <input type="radio" name="sex" value="1" title="男" {{if $admin['sex'] == 1}}checked {{/if}}>
                        <input type="radio" name="sex" value="2" title="女" {{if $admin['sex'] == 2}}checked {{/if}}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">头像</label>
                    <div class="layui-input-block">

                        <button type="button" class="layui-btn layui-btn-primary" id="upload_img">上传图片</button>
                        <div id="upload_img_list" name="avatar" data-img_num="1" data-value="{{$admin['avatar']}}"> </div>

                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="edit">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>


<script src="{{__STATIC__}}/lib/layui/layui.js"></script>
<script>
    $("#upload_img").upfile($("#upload_img_list").attr('data-img_num'),$("#upload_img_list").attr('data-value'))


    layui.use(["form", "okLayer", "okUtils"], function () {
        let form = layui.form;
        let okLayer = layui.okLayer;
        let okUtils = layui.okUtils;
        okLoading.close();


        //普通图片上传

        form.on("submit(edit)", function (data) {
            okUtils.ajax("/admin/User/user_info", "post", data.field, true).done(function (response) {
                console.log(response);
                okLayer.greenTickMsg(response.msg, function () {

                });
            }).fail(function (error) {
                console.log(error)
            });
            return false;
        });
    })



</script>

</body>

</html>